package org.example.springframework;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @fileName: {@link BeanFactory}
 * @author: yyfl
 * @date: 2023/2/13 16:56
 * @description:
 * @history:
 */
public class BeanFactory {

    Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<>();

    public Object getBean(String name){
        return beanDefinitionMap.get(name).getBean();
    }

    public void registerBeanDefinition(String name, BeanDefinition beanDefinition){
        beanDefinitionMap.put(name, beanDefinition);
    }
}
